<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <jsp:include page="/inc/head.jsp"/>
    <title>部门管理</title>
</head>
<body>
<jsp:include page="/inc/top.jsp"/>
<div class="container">
    <jsp:include page="inc.jsp"/>
    <table class="table table-bordered table-striped table-hover">
        <thead>
        <tr>
            <td colspan="7">
                <form class="form-inline" action="" id="searchForm" method="get"
                      style="padding-bottom: 0px;margin: 0px">
                    <input type="hidden" value="1" name="pageIndex" id="pageIndex"/>
                    <div class="form-group">
                        <label>姓名:</label>
                        <input type="text" class="form-control" value="${searchObj.name}" name="name"
                               placeholder="输入部门姓名">
                    </div>
                    <div class="form-group">
                        <label>类型:</label>
                        <select name="type" class="form-control">
                            <option value="">选择类型</option>
                            <c:forEach items="${types}" var="type">
                                <c:if test="${type.key==searchObj.type}">
                                    <option value="${type.key}" selected>${type.value}</option>
                                </c:if>

                                <c:if test="${type.key!=searchObj.type}">
                                    <option value="${type.key}">${type.value}</option>
                                </c:if>
                            </c:forEach>
                        </select>
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>
            </td>
        </tr>
        <tr>
            <td>部门标识</td>
            <td>部门名称</td>
            <td>部门类型</td>
            <td>部门电话</td>
            <td>操作</td>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${datas.data}" var="dep">
            <tr>
                <td>${dep.id}</td>
                <td>${dep.name}</td>
                <td>${dep.typeDesc}</td>
                <td>${dep.phone}</td>
                <td>
                    <a href="javascript:confirmOp('<%=request.getContextPath()%>/admin/dep/delete/${dep.id}','删除部门对象不可逆，确定删除${dep.id}吗?')"
                       class="btn btn-danger">删除</a>
                    <a href="<%=request.getContextPath()%>/admin/dep/update/${dep.id}" class="btn btn-warning">更新</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
        <jsp:include page="/inc/pager.jsp"/>
    </table>
</div>
</body>
</html>
